package com.xzc.java8.B_Stream.g_find;

import java.util.ArrayList;
import java.util.List;

public class FindAnyTest {

    public static void main(String[] args) {
        List<Apple> list0 = new ArrayList<>();
        Apple a0 = new Apple("blue", "1");
//        Apple a1 = new Apple("blue");
        Apple a1 = new Apple("red", "2");
//        Apple a2 = new Apple("yellow");
        Apple a2 = new Apple("red", "3");
        Apple a3 = new Apple("red", "4");
        list0.add(a0);
        list0.add(a1);
        list0.add(a2);
        list0.add(a3);

        list0.stream().filter(Apple::isRedApple).findAny().ifPresent(d -> System.out.println(d.getName()));
    }
}
